'use strict';

describe('show current template', function() {
  var $show;

  beforeEach(module('fbdApp.templateModule'));
  beforeEach(inject(function(_$filter_) {
    $show = _$filter_('showCurrentTemp');
  }));

  it('should be defined', function(done) {
    expect($show).toBeDefined();
    return done();
  });

  var currentTemp = {
    rules: {
      pages: {
        name: 'pages',
        mode: 'signs',
        beginText: '<<<',
        type: 1,
        expression: 'a13ca',
        limit: 4,
        similar: 4,
        subset: {
          rules: {
            title: {
              name: 'title',
              mode: 'signs',
              beginText: '>>>',
              type: 3,
              expression: 'a13a2',
              limit: 2,
              similar: 1
            },
            author: {
              name: 'author',
              mode: 'signs',
              beginText: '123>>>',
              type: 3,
              expression: 'abc12',
              limit: 2,
              similar: 2
            },
            summary: {
              name: 'summary',
              mode: 'signs',
              beginText: '<<<123',
              type: 1,
              expression: '13d8a',
              limit: 5,
              similar: 3,
              subset: {
                rules: {
                  title2: {
                    name: 'title2',
                    mode: 'signs',
                    beginText: '>>>333',
                    type: 3,
                    expression: 'a33a2',
                    limit: 2,
                    similar: 1
                  }
                },
                includes: ['title2'],
                require: [],
                before: [],
                after: []
              }
            }
          },
          includes: ['title', 'author', 'summary'],
          require: [],
          before: [],
          after: []
        }
      }
    },
    includes: ['pages'],
    require: ['pages'],
    before: [],
    after: []
  };

  var expected = [{
    name: 'title',
    mode: 'signs',
    beginText: '>>>',
    type: 3,
    expression: 'a13a2',
    limit: 2,
    similar: 1
  }, {
    name: 'author',
    mode: 'signs',
    beginText: '123>>>',
    type: 3,
    expression: 'abc12',
    limit: 2,
    similar: 2
  }, {
    name: 'summary',
    mode: 'signs',
    beginText: '<<<123',
    type: 1,
    expression: '13d8a',
    limit: 5,
    similar: 3
  }];

  it('show current temp array', function(done) {
    expect($show(currentTemp)).toEqual(expected);
    return done();
  });
})
